import git
import time
def git_push():
    repo = git.Repo.init(path='.')
    #关联远程库
    try:
        remote = repo.create_remote(name='ph_code', url='git@gitee.com:mingzhan/p_colde.git')
    except:
        print(111)

    repo.index.add(items='*')
    #
    repo.index.commit(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))

    remote = repo.remote('ph_code')
    # 推送本地修改到远程仓库
    remote.pull('master')
    #测试测试
    remote.push("master")